package com.springdoor.wx.config;

import com.springdoor.wx.utils.string.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "wx")
public class WxConfig {

    /** 项目名称 */
    private static String urlTemplate;
    /** 项目名称 */
    private static String appid;
    /** 项目名称 */
    private static String secret;
    /** 项目名称 */
    private static String grantType;

    private static String serverName;

    private static String version;

    private static String profile;

    public static String getUrlTemplate() {
        return StringUtils.format(urlTemplate, appid, secret, grantType);
    }

    public void setUrlTemplate(String urlTemplate) {
        WxConfig.urlTemplate = urlTemplate;
    }

    public void setAppid(String appid) {
        WxConfig.appid = appid;
    }

    public void setSecret(String secret) {
        WxConfig.secret = secret;
    }

    public void setGrantType(String grantType) {
        WxConfig.grantType = grantType;
    }

    public static String getServerName() {
        return serverName;
    }

    public void setServerName(String serverName) {
        WxConfig.serverName = serverName;
    }

    public static String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        WxConfig.version = version;
    }

    public static String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        WxConfig.profile = profile;
    }
}
